package com.bs.manager05.service.impl;

import com.bs.manager05.entity.Userrole;
import com.bs.manager05.mapper.UserroleMapper;
import com.bs.manager05.service.IUserroleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 用户角色关联表 服务实现类
 * </p>
 *
 * @author yao
 * @since 2022-12-18
 */
@Service
public class UserroleServiceImpl extends ServiceImpl<UserroleMapper, Userrole> implements IUserroleService {

    @Resource
    UserroleMapper mapper;

    @Transactional
    @Override
    public int addRoles(String userid, String[] roleids) {
        mapper.delRoleById(userid);
        int row = mapper.addRoles(userid, roleids);
        return row;
    }
}
